﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNav.Model
{
    public class EnquiryModel
    {
        [Required, Display(Name = "Description")]
        public string Description { get; set; }

        [Required, Display(Name = "Product")]
        public int? ProductID { get; set; }

        [Required, Display(Name = "Complaint type")]
        public int? ComplaintType { get; set; }

        public int?  ConsumerID { get; set; }

        [Required, Display(Name = "Business name")]
        public string BusinessName { get; set; }

        public SearchModel SearchModel { get; set; }
        public BusinessModel BusinessModel { get; set; }
        public RenderControlListModel RenderControlListModel { get; set; }

        public int? FormID { get; set; }

        public EnquiryModel()
        {
            SearchModel = new SearchModel();
            BusinessModel=new BusinessModel();
            RenderControlListModel = new RenderControlListModel();
        }
    }

    public class SearchModel
    {
        [Display(Name = "Search")]
        public string SearchText { get; set; }

        [Display(Name = "Search By")]
        public string SearchType { get; set; }

        public IEnumerable<string> SearchTypes
        {
            get
            {
                return new[] {"FirstName", "LastName", "BirthDate", "Email", "Phone", "PostCode"};
            }
        }
    }

    public class ConsumerModel
    {
        public int ID { get; set; }

        [Required, Display(Name = "Title")]
        public string Title { get; set; }

        [Required, Display(Name = "Name")]
        public string FirstName { get; set; }

        [Required, Display(Name = "Middle")]
        public string MiddleName { get; set; }

        [Required, Display(Name = "Surname")]
        public string LastName { get; set; }

        [Required, Display(Name = "Birth date")]
        public DateTime BirthDate { get; set; }

        [Display(Name = "Email"), EmailAddress]
        public string Email { get; set; }

        [Required, Display(Name = "Phone"), Phone]
        public string PhoneNumber { get; set; }

        [Display(Name = "Fax"), Phone]
        public string FaxNumber { get; set; }

        public AddressModel AddressModel { get; set; }

        public IList<string> TitleList
        {
            get { return new[] { "Mr", "Mrs", "Miss", "Dr" }; }
        }

        public ConsumerModel()
        {
            AddressModel = new AddressModel();
        }
    }

    public class BusinessModel
    {
        [Required, Display(Name = "Business name")]
        public string BusinessName { get; set; }

        [Required, Display(Name = "Email address"), EmailAddress]
        public string Email { get; set; }

        public AddressModel Address { get; set; }

        [Required, Display(Name = "Phone"), Phone]
        public string PhoneNumber { get; set; }

        [Display(Name = "Fax"), Phone]
        public string FaxNumber { get; set; }
    }
}
